<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>调节资金账号</title>
<link href="__PUBLIC__/admin/css/xc.min.css" rel="stylesheet" type="text/css" />
<link href="__PUBLIC__/admin/css/xc.admin.css" rel="stylesheet" type="text/css" />
<link href="__PUBLIC__/lib/iconfont/iconfont.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="__PUBLIC__/admin/js/jquery.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/admin/js/common-1.0.js"></script>
<script type="text/javascript" src="__PUBLIC__/lib/layer/layer.js"></script>
<script type="text/javascript" src="__PUBLIC__/admin/js/xc.js"></script> 
<script type="text/javascript" src="__PUBLIC__/admin/js/xc.admin.js"></script>

</head>
<body>
<div class="pd-5">
  <form action="#" method="post" class="form form-horizontal" id="myform">
    <div class="row cl">
      <label class="form-label col-3"><span class="c-red">*</span>会员编号：</label>
      <div class="formControls col-8" style="margin-top:3px;">{$re.us_uid}</div>
    </div>
    <div class="row cl">
      <label class="form-label col-3"><span class="c-red">*</span>会员姓名：</label>
      <div class="formControls col-8" style="margin-top:3px;">{$re.us_name}【{$re.us_phone}】</div>
    </div>
    <div class="row cl">
      <label class="form-label col-3"><span class="c-red">*</span>余额：</label>
      <div class="formControls col-8">
        <span class="select-box inline">
          <select class="select" name="monType">
            <option value="1">增加</option>
            <option value="0">减少</option>
          </select>
        </span>
        <input type="text" id="money" name="money" class="input-text" placeholder="请输入金额，单位：元" style="width:50%" onKeyUp="this.value=/^\d+\.?\d{0,2}$/.test(this.value) ? this.value : ''" onFocus="clearInput('frozen')">
      	<span>可用余额<b> {$re.us_money} </b>元</span>
      </div>
    </div>
    <div class="row cl">
      <label class="form-label col-3"><span class="c-red">*</span>冻结积分：</label>
      <div class="formControls col-8">
        <span class="select-box inline">
          <select class="select" name="poinType">
            <option value="1">增加</option>
            <option value="0">减少</option>
          </select>
        </span>
        <input type="text" id="points" name="points" class="input-text" placeholder="请输入冻结积分，单位：个" style="width:50%">
        <span>可用冻结积分<b> {$re.us_newpoints} </b>个</span>
      </div>
    </div>
    <div class="row cl">
      <label class="form-label col-3"><span class="c-red">*</span>购物积分：</label>
      <div class="formControls col-8">
        <span class="select-box inline">
          <select class="select" name="froType">
            <option value="1">增加</option>
            <option value="0">减少</option>
          </select>
        </span>
        <input type="text" id="frozen" name="frozen" class="input-text" placeholder="请输入购物积分，单位：元" style="width:50%" onKeyUp="this.value=/^\d+\.?\d{0,2}$/.test(this.value) ? this.value : ''" onFocus="clearInput('money')">
        <span>购物积分<b> {$re.us_frozen} </b>元</span>
      </div>
    </div>
    <div class="row cl">
      <label class="form-label col-3"><span class="c-red">*</span>股权：</label>
      <div class="formControls col-8">
        <span class="select-box inline">
          <select class="select" name="equType">
            <option value="1">增加</option>
            <option value="0">减少</option>
          </select>
        </span>
        <input type="text" id="equity" name="equity" class="input-text" placeholder="请输入股权，单位：元" style="width:50%" onKeyUp="this.value=/^\d+\.?\d{0,2}$/.test(this.value) ? this.value : ''" onFocus="clearInput('money')">
        <span>股权<b> {$re.us_equity} </b>元</span>
      </div>
    </div>
    <div class="row cl">
      <label class="form-label col-3"><span class="c-red">*</span>操作备注：</label>
      <div class="formControls col-8">
        <textarea type="text" id="desc" name="desc" class="textarea" placeholder="请填写备注信息"></textarea>
      </div>
    </div>
    <input type="hidden" id="id" name="id" value="{$re.us_uid}">
    <div class="row cl">
      <div class="col-9 col-offset-3">
        <button type="button" id="sub" name="sub" class="btn btn-primary radius" onClick="checkSubmit()"><i class='Hui-iconfont'>&#xe632;</i> 保存</button>
        <button class="btn btn-default radius" type="button" onClick="layer_close();"><i class='Hui-iconfont'>&#xe66b;</i> 取消</button>
      </div>
    </div>
  </form>
</div>
<script type="text/javascript">
//按回车件触发提交
document.onkeydown=function(event){
	var e = event || window.event || arguments.callee.caller.arguments[0];
	if(e && e.keyCode==13){ // enter 键
		checkSubmit();
	}
}; 
//提交数据
function checkSubmit()
{
	var money  = $.trim($('#money').val());
	var points = $.trim($('#points').val());
	var frozen = $.trim($('#frozen').val());
	var desc   = $.trim($('#desc').val());
	if((money=='') && (points='') && (frozen=='')){
		layer.msg('输入调节金额不能为空!', {icon: 2});
		return false;
	}if(desc==''){
		layer.msg('备注信息不能为空!', {icon: 2});
		return false;
	}
	$.ajax({
		type : 'post',
		url : '__MODULE__/Income/upUserIncome',
		data : $("#myform").serialize(),
		dataType : 'json',
		success : function(res){
			if(res.status == 1){
				layer.msg(res.info,{icon:1,time:2000},function(){
					// 先获取窗口索引，才能关闭窗口  
					var index = parent.layer.getFrameIndex(window.name);
					parent.layer.close(index);
				});
				parent.call_back_fun('success');
			}else{
				layer.msg(res.info, {icon: 2});
			}
		},
		error : function(XMLHttpRequest, textStatus, errorThrown) {
			layer.alert('网络失败，请刷新页面后重试',{icon:2});
		}
	})
}
function clearInput(id){
	$('#'+id).val(0);
}
</script>
</body>
</html>